package com.yoso.springcloud.service.impl;

import com.yoso.springcloud.dao.PaymentRepository;
import com.yoso.springcloud.domain.Payment;
import com.yoso.springcloud.service.PaymentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Optional;

/**
 * @Description:
 * @Date: 2021/10/12 17:16
 */
@Service
public class PaymentServiceImpl implements PaymentService {
    @Resource
    private PaymentRepository paymentRepository;
    @Override
    public Payment save(Payment payment) {
        return paymentRepository.save(payment);
    }

    @Override
    public Payment getPaymentById(Long id) {

        Optional<Payment> result = paymentRepository.findById(id);
        return result.orElse(null);
    }
}
